package com.cangsan.erhai.security;

import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

public class WechatAuthenticationToken extends AbstractAuthenticationToken {
    private  Object principal;



    private  Object phoneCode;
    private Object nickName;
    private Object imageUrl;

    public WechatAuthenticationToken(String loginCode, String phoneCode, String nickName, String imageUrl) {
        super(null);
        this.principal = loginCode;
        this.phoneCode=phoneCode;
        this.nickName=nickName;
        this.imageUrl=imageUrl;
        setAuthenticated(false);
    }
    public WechatAuthenticationToken(Object principal, Collection<? extends GrantedAuthority> authorities) {
        super(authorities);
        this.principal = principal;
        super.setAuthenticated(true);
    }



    @Override
    public Object getCredentials() {
        return null;
    }

    @Override
    public Object getPrincipal() {
        return this.principal;
    }

    public Object getPhoneCode() {
        return phoneCode;
    }

    public Object getNickName() {
        return nickName;
    }

    public Object getImageUrl() {
        return imageUrl;
    }
}
